﻿<UserControl x:Class="Startup.Shell.Modules.ClassEditorModule.ClassEditorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:ClassEditorModule="clr-namespace:Startup.Shell.Modules.ClassEditorModule"
             xmlns:FunctionalityContracts="clr-namespace:Startup.Shell.Domain.FunctionalityContracts"
             xmlns:Controls="clr-namespace:Startup.Shell.Controls" mc:Ignorable="d" 
             d:DataContext="{x:Static ClassEditorModule:ClassEditorViewModel.Designer}"
             d:DesignHeight="300" d:DesignWidth="804">
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<ToolBar>
			<Button Content="New" Command="{Binding NewPropertyCommand}"/>
		</ToolBar>

		<DataGrid ItemsSource="{Binding Properties}" Grid.Row="1" Background="White" CanUserAddRows="False" CanUserDeleteRows="False"
                  AlternatingRowBackground="LightGray" AutoGenerateColumns="False" GridLinesVisibility="None">
			<DataGrid.Columns>
				<DataGridTemplateColumn Header="Type">
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<TextBox Text="{Binding Type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Background="Transparent" BorderBrush="Transparent"/>
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
				</DataGridTemplateColumn>
				<DataGridCheckBoxColumn Header="Is Collection" Binding="{Binding IsCollection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
				<DataGridTemplateColumn Header="Name">
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Background="Transparent" BorderBrush="Transparent"/>
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
				</DataGridTemplateColumn>
				<DataGridTemplateColumn Header="Data Contact">
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<ComboBox DataContext="{Binding}" SelectedValue="{Binding Path=DataContract, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding AvailableContracts}" Background="Transparent" BorderBrush="Transparent" MinWidth="150"/>
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
				</DataGridTemplateColumn>
			</DataGrid.Columns>
		</DataGrid>
	</Grid>
</UserControl>
